package com.freecloud.javabasics.design.prototype;

import com.freecloud.common.LoggerUtil;
import com.freecloud.javabasics.design.entity.car.BMW;
import com.freecloud.javabasics.design.entity.car.Car;

/**
 * 原型模式
 * @Author: maomao
 * @Date: 2019-10-31 08:44
 */
public class Prototype {

    public static void main(String[] args) {
        BMW car = new BMW();
        try {
            Car car1 = (Car) car.clone();

            System.out.println(car);
            car.println();
            System.out.println(car1);
            car1.println();

            LoggerUtil.println("地址比较：%s" ,(car == car1));

            LoggerUtil.split();

            System.out.println(car.getManufacturers());
            System.out.println(car1.getManufacturers());
            System.out.println(car.getManufacturers() == car1.getManufacturers());
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
    }
}
